package com.burstly.lib.component.networkcomponent.burstly.html;

import android.content.Context;
import android.view.View;
import com.burstly.lib.component.IBurstlyAdaptor.AdaptorAction;
import com.burstly.lib.component.IBurstlyAdaptor.BurstlyAdType;
import com.burstly.lib.component.networkcomponent.burstly.html.rewards.RewardsFullscreenOverlay;
import com.burstly.lib.component.networkcomponent.burstly.html.rewards.RewardsView;
import com.burstly.lib.network.beans.ResponseBean.ResponseData;
import com.burstly.lib.util.LoggerExt;
import com.burstly.lib.util.UiSafeWebView;
import com.burstly.lib.util.Utils;
import java.util.Map;

final class RewardsScriptAdaptor extends BurstlyBaseScriptAdaptor
{
  private static final String SCRIPT_INTERFACE_NAME = "ScriptActivity";
  UrlProvider mUrlProvider;

  RewardsScriptAdaptor(Context paramContext, String paramString)
  {
    super(paramContext, paramString);
  }

  private void loadAd(boolean paramBoolean)
  {
    setPrecacheInterstitialRequest(paramBoolean);
    new WebViewFactory(getContext(), getResponseData(), getFullResponse()).createImplementation(this, isFullscreen());
    if (!paramBoolean)
    {
      onInterstitialHtmlLoaded();
      if (this.mUrlProvider.getUrl() == this.mDataToPost)
        break label90;
    }
    label90: for (String str = this.mDataToPost; ; str = null)
    {
      postRequest(this.mUrlProvider.getUrl(), str);
      return;
      getWebView().setWebViewClient(new BurstlyBaseScriptAdaptor.InterstitialLoadedWebViewClient(this));
      break;
    }
  }

  protected void checkParameters(Map<String, ?> paramMap)
    throws IllegalArgumentException
  {
    super.checkParameters(paramMap);
    ResponseBean.ResponseData localResponseData = getResponseData();
    this.mUrlProvider = new UrlProvider(localResponseData.getUrl());
    setFullscreen(true);
    this.mDataToPost = localResponseData.getData();
    if (this.mUrlProvider.getUrl() == null)
      this.mUrlProvider.setUrl(this.mDataToPost);
    Utils.checkNotNull(this.mUrlProvider.getUrl(), "Url for rewards can not be null");
  }

  protected ScriptInterstitialOverlay<?> createFullscreenOverlay()
  {
    return new RewardsFullscreenOverlay((RewardsView)getWebView());
  }

  protected View doGetNewAd()
  {
    loadAd(false);
    return null;
  }

  public IBurstlyAdaptor.BurstlyAdType getAdType()
  {
    return IBurstlyAdaptor.BurstlyAdType.INTERSTITIAL_AD_TYPE;
  }

  public void onShowOverlay()
  {
    super.onShowOverlay();
    if (!isPrecacheInterstitialRequest())
      ((LoadingAwareWebView)getWebView()).showLoadingBar();
  }

  public View precacheAd()
  {
    LOG.logInfo(this.mTag, "Precache rewards banner currently not supported", new Object[0]);
    return null;
  }

  public void precacheInterstitialAd()
  {
    loadAd(true);
  }

  public void rewardsViewCreated(RewardsView paramRewardsView)
  {
    super.rewardsViewCreated(paramRewardsView);
    paramRewardsView.addJavascriptInterface(paramRewardsView, "ScriptActivity");
  }

  public boolean supports(String paramString)
  {
    return IBurstlyAdaptor.AdaptorAction.PRECACHE_INTERSTITIAL.getCode().equals(paramString);
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.networkcomponent.burstly.html.RewardsScriptAdaptor
 * JD-Core Version:    0.6.2
 */